package com.ali.validator;

import com.ali.util.RegexUtils;
import com.ali.validator.annotation.Mobile;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author jack.wu
 * @version 1.0
 * @date 2020/7/24
 */
public class MobileValidator implements ConstraintValidator<Mobile, String> {

    @Override
    public void initialize(Mobile constraintAnnotation) {

    }

    @Override
    public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
        return RegexUtils.isMobilePhoneNumber(value);
    }
}
